package com.whu.UVAProtocol;



import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.timeout.IdleStateHandler;

import java.util.concurrent.TimeUnit;

/**
 * @Description
 * @Author chengeng
 * @Date 2021/10/28 17:03
 **/
public class UVAServerInitializer extends ChannelInitializer<SocketChannel> {


    @Override
    protected void initChannel(SocketChannel socketChannel) {
        ChannelPipeline pipeline = socketChannel.pipeline();
        pipeline.addLast(new UVAMsgEncoder());
        pipeline.addLast(new UVAMsgDecoder());
        //心跳检测处理器
        pipeline.addLast(new IdleStateHandler(10,10,10, TimeUnit.SECONDS));
        pipeline.addLast("serverHandler",new UVAServerHandler());

    }
}
